#ifndef _ACTION_DISTANCE_H_
#define _ACTION_DISTANCE_H_

#include "../../RPGAction.h"

class Action_Distance : public RPGAction
{

protected:
	Sprite m_sLanza;

public:

	Action_Distance() : RPGAction()
	{
		// seteo los valores de la accion
		pAnimation = new Animation();
		pAnimation->Load("./data/actions/distance.ani");	// cargo la animacion
		strcpy(pszName, "Distance");
		fTimeToExecute = 1.0f;
		fTimeToFinish = 350.0f;
	}
	
	~Action_Distance()
	{
		delete pAnimation;
	}

	// sobrecargas de los metodos de RPGAction
	void Execute(RPGCharacter *pCharacter)
	{
		RPGAction::Execute(pCharacter);

		if(!pCharacter->m_Shot.m_bInUse){
			pCharacter->m_Shot.SetMoving(true);
			pCharacter->m_Shot.SetCheckCollision(true);
			if(!pCharacter->m_bRotated){
				pCharacter->m_Shot.SetFrame(0);
				pCharacter->m_Shot.SetMovDirection(90);
				pCharacter->m_Shot.SetPos(pCharacter->GetPosX()+pCharacter->m_fShotPosX,pCharacter->GetPosY()+pCharacter->m_fShotPosY);
			}
			else
			{
				pCharacter->m_Shot.SetFrame(1);
				pCharacter->m_Shot.SetMovDirection(270);
				pCharacter->m_Shot.SetPos(pCharacter->GetPosX()+pCharacter->m_fShotPosXRotated,pCharacter->GetPosY()+pCharacter->m_fShotPosYRotated);
			}
			pCharacter->m_Shot.m_fStartPosX = pCharacter->m_Shot.GetPosX();
			pCharacter->m_Shot.SetVisible(true);
			pCharacter->m_Shot.m_bInUse = true;
		}

		
	}
};

#endif //_ACTION_DISTANCE_H_